package com.aynu.admin.domain;

import lombok.AllArgsConstructor;
import lombok.Data;

@AllArgsConstructor
@Data
public class CommonResponse <T>{
    private int code;
    private String message;
    private T data;

    public static final CommonResponse<Object> SUCCESS=new CommonResponse<>(200,"请求成功",null);
//    public static final CommonResponse<Object> failed=new CommonResponse<>(-200,"请求失败",null);

    public static <T> CommonResponse<T> success(T data){
        return new CommonResponse<>(200,"请求成功",data);
    }
    public static <T> CommonResponse<T> failed(String message){
        return new CommonResponse<>(-200,message,null);
    }
}
